package cn.sz.user.service.impl;

import cn.sz.user.dao.UserMapper;
import cn.sz.user.entity.User;
import cn.sz.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("userService")
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    public void addUser(User user) {
        userMapper.insert(user);
    }

    public User getUserById(long id) {
        return userMapper.selectByPrimaryKey(id);
    }

    public List<User> getAll() {
        return userMapper.listUser();
    }
}
